package com.hns.phone.master.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hns.can.base.entity.SysUserEntity;
import com.hns.can.common.domain.ReturnResult;
import com.hns.can.common.web.BaseController;
import com.hns.can.master.vo.LeftOrgVo;
import com.hns.frame.enumrate.RequestResult;
import com.hns.phone.master.service.PhoneOrganService;
import com.hns.tool.pub.SearchConditionVo;
@Controller
@RequestMapping("/api/phoneOrgan")
public class PhoneOrganController extends BaseController {
	
  @Autowired
  private PhoneOrganService phoneOrganService;
	
    /**
     * 
     * @param request
     * @param response
     * @author:zhangyu
     * @email:zhangyu2222z@sina.cn
     */
    @RequestMapping(value="/getRefrashedLeftOrgTreeNew01")
    @ResponseBody
    public Object getRefrashedLeftOrgTreeNew01(HttpServletRequest request) {
		SysUserEntity currentUser = this.getPhoneCurrentUser();
    	ReturnResult vo = null;
		vo = new ReturnResult(RequestResult.SUCCESS.getFlag(), RequestResult.SUCCESS.getDescr());
		SearchConditionVo searchVo = new SearchConditionVo();
		searchVo.setUserid(currentUser.getId());
		List<LeftOrgVo> leftOrg = phoneOrganService.getLeftOrg4Car4Phone(searchVo);
		vo.setObj(leftOrg);
		return vo;
    }
    
    /**
     * 刷新组织结构树
     * @param request
     * @param response
     * @author:zhangyu
     * @email:zhangyu2222z@sina.cn
     */
    @RequestMapping(value="/getRefrashedLeftOrgTree")
    @ResponseBody
    public Object getRefrashedLeftOrgTree(HttpServletRequest request){
    	SysUserEntity currentUser = (SysUserEntity) request.getSession().getAttribute("SES_CURRENTUSER");
//		SysUserEntity currentUser = this.getAppCurrentUser().getUser();
    	ReturnResult vo = null;
		vo = new ReturnResult(RequestResult.SUCCESS.getFlag(), RequestResult.SUCCESS.getDescr());
		SearchConditionVo searchVo = new SearchConditionVo();
		searchVo.setUserid(currentUser.getId());
		List<LeftOrgVo> leftOrg = phoneOrganService.getLeftOrg4Car(searchVo);
		vo.setObj(leftOrg);
		return vo;
    }
    
}
